<template>
  <div id="home">
    <main-header></main-header>
    <div>{{nodeInfo}}</div>
  </div>
</template>

<script>
import {USER_INFO} from '~/store/types'
import MainHeader from '~/components/mainHeader.vue'
import {getUserInfo} from '~/assets/services/user'
import {getNodeInfo} from '~/assets/services/node'

export default {
  components: {
    MainHeader
  },
  data() {
    return {
      nodeInfo: null
    }
  },
  async asyncData() {
    let res = await getNodeInfo({name: 'python'})
    return {
      nodeInfo: res
    }
  },
  computed: {
    userInfo () {
      return this.$store.state.user.userInfo
    }
  },
  mounted() {
    this.initData()
  },
  methods: {
    initData() {
        let params = {
            username: "Livid"
        }
        getUserInfo(params).then(res => {
            this.$store.commit(USER_INFO, res.data)
        })
    }
  }
}
</script>

<style lang="scss" scope>
@import "@/assets/styles/base";
#home {
  height: 100vh;
  background-color: $backgroundColor;
}
</style>
